# -*- coding: utf-8 -*-
import pywifi
import time
import sys 
sys.stdout.reconfigure(encoding='utf-8')

def scan_wifi():
    wifi = pywifi.PyWiFi()
    iface = wifi.interfaces()[0]
    iface.scan()
    time.sleep(2)  # 扫描需要时间，稍作延迟
    scan_results = iface.scan_results()
    for network in scan_results:
        print(f"SSID: {network.ssid}, 信号: {network.signal}")

def main():
    scan_wifi()

if __name__ == "__main__":
    main()